﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PropertyManagement.zhuhu
{
    public partial class addZhuHu : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string sname, lddy, fanghao, fangxing, jzmj, qrdate, tel;
            int n;

            sname = txtsname.Text;
            lddy = DropDownList1.SelectedValue;
            fanghao = txtfanghao.Text;
            fangxing = DropDownList2.SelectedValue;
            jzmj = txtjzmj.Text;
            qrdate = txtqrdate.Text;
            tel = txttel.Text;


            string strsql = "insert into szhuhu(sname, lddy, fanghao, fangxing, jzmj, qrdate, tel) values("
            + "'" + sname + "',"
            + "'" + lddy + "',"
            + "'" + fanghao + "',"
            + "'" + fangxing + "',"
            + "'" + jzmj + "',"
            + "'" + qrdate + "',"
            + "'" + tel + "'"
            + ")";

            mydata myda = new mydata();
            n = myda.execSql(strsql);
            if (n > 0)
            {
                Response.Write("<script language=javascript> alert('添加数据成功') </script>");
            }
            else
            {
                Response.Write("<script language=javascript> alert('添加数据失败') </script>");
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("browerZhuHu.aspx");
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            Response.Redirect("selectZhuHu.aspx");
        }
        
    }
}